#include "main/utils.h"
#include "lib/binary_tree.h"
using namespace std;

void pruneTree(BinaryTreeNode* &root) {
  if (!root)
    return;
  pruneTree(root->left);
  pruneTree(root->right);
  if (!root->left && !root->right && root->value == 0) {
    root = nullptr;
    return;
  }
}

int main() {
  vector<int> vec = {1, 0, 0, 0, 0, 0, 1};
  BinaryTreeNode* root = CreateBinaryTree(vec);
  pruneTree(root);
  PrintBinaryTree(root);

  return 0;
}
